package com.atshiyou.controller;

import com.atshiyou.bean.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
public class JsonController {

    @RequestMapping("/getuser")
    public @ResponseBody User getuser(){
        User user = new User();
        user.setUsername("mikeJson");
        user.setAge(51);
        System.out.println("getUser-------->");
        return user;
    }

    @RequestMapping("/getusers")
    public @ResponseBody List<User> getusers(){
        List list = new ArrayList();
        User user = new User();
        user.setUsername("mikeJson");
        user.setAge(51);
        User user2 = new User();
        user2.setUsername("jackChen");
        user2.setAge(65);
        list.add(user);
        list.add(user2);
        return list;
    }

}
